Allow both hackney 1.x and 4.x - #170
Conversation
Let's allow both old and new hackney versions in order to make the transition easier for downstream projects. Closes lau#155.
|
@lau this is a good fix. Any thoughts? |
|
@lau hi, i hope you're doing great. this pr contains important changes to mitigate the vulnerability with hackney, i hope you can speed up the resolution process. |
|
Hi, @lau Any chance to merge it and bump a new version for tzdata ? |
| # Hackney 4.x returns the body as a binary in the result from :hackney.get | ||
| {:ok, result} | ||
| end | ||
| defp get_body(client_ref) do |
There was a problem hiding this comment.
I think it's best to drop support for Hackney 1.x considering hackney 1.x is vulnerable and this major version won't be maintained anymore.
There was a problem hiding this comment.
Longer term, absolutely. My goal with this change is to make it easier for a project with a complex dependency tree to move towards Hackney 4.x. If one dependency depends on Hackney 1.x and another depends on 4.x, the upgrade is blocked, but if tzdata allows both versions, then progress towards Hackney 4.x can be made step by step.
| end | ||
| defp get_body(client_ref) do | ||
| # Hackney 1.x returns a client_ref that we can fetch the body from | ||
| :hackney.body(client_ref) |
There was a problem hiding this comment.
should there be a deprecation warning here?
|
can |
That is a good point. I think it makes sense to declare it as optional. I wasn't sure whether to include it in this pull request or as a separate change, but maybe that's worth doing. |
|
+1
Also see #155 |
|
+1 Also see #155 |
|
@lau Can we get this moving? It is killing my deploy flow. |
You can fork it first😂 |
hackney 4.x carries the fixes for the four advisories .mix_audit.ignore was suppressing, so both ignore lists shrink to what is genuinely unfixable. - hackney 4.4.5 -> 4.6.0, which fixes a hackney_conn process leak on connections flagged no_reuse. 4.6.0 is the ceiling: 4.6.1 and later require h2 ~> 0.11.0 while hackney's own webtransport dep requires h2 ~> 0.10.4. - swoosh -> 1.26.3, fixing CVE-2026-54893. This needs tidewave 0.8, because swoosh 1.18.3 and later require req ~> 0.5.10, and every req that new requires mime ~> 2.0, which google_gax pins away from. tidewave 0.8 drops req altogether, so req leaves the tree and takes CVE-2026-49755 with it. - tzdata tracks upstream master for `hackney ~> 1.17 or ~> 4.0` (lau/tzdata#170), which is not on Hex yet. - Drop metrics and unicode_util_compat from the lock; hackney 4 depends on neither. .mix_audit.ignore is now empty and hex_audit/0 is down to the two cowlib advisories with no patched release. The file stays because CI passes it via --ignore-file and mix_audit reads it with File.read!/1. Filter the httpoison 3 callback contract warnings: hackney 4 made a client handle a pid where it was a reference, but HTTPoison.AsyncResponse.t() still declares id: reference().
* First pass at updating and overriding * Tests passing * Update Sentry config for new version * Mitigate typespec issues in httpoison * DIsable tzupdates for now * Take hackney 4.6 and clear the resolved advisories hackney 4.x carries the fixes for the four advisories .mix_audit.ignore was suppressing, so both ignore lists shrink to what is genuinely unfixable. - hackney 4.4.5 -> 4.6.0, which fixes a hackney_conn process leak on connections flagged no_reuse. 4.6.0 is the ceiling: 4.6.1 and later require h2 ~> 0.11.0 while hackney's own webtransport dep requires h2 ~> 0.10.4. - swoosh -> 1.26.3, fixing CVE-2026-54893. This needs tidewave 0.8, because swoosh 1.18.3 and later require req ~> 0.5.10, and every req that new requires mime ~> 2.0, which google_gax pins away from. tidewave 0.8 drops req altogether, so req leaves the tree and takes CVE-2026-49755 with it. - tzdata tracks upstream master for `hackney ~> 1.17 or ~> 4.0` (lau/tzdata#170), which is not on Hex yet. - Drop metrics and unicode_util_compat from the lock; hackney 4 depends on neither. .mix_audit.ignore is now empty and hex_audit/0 is down to the two cowlib advisories with no patched release. The file stays because CI passes it via --ignore-file and mix_audit reads it with File.read!/1. Filter the httpoison 3 callback contract warnings: hackney 4 made a client handle a pid where it was a reference, but HTTPoison.AsyncResponse.t() still declares id: reference(). * Pin hackney to HTTP/1.1 and keep tzdata updates out of tests hackney 4 negotiates HTTP/2 by default where 1.x was HTTP/1.1 only. Concurrent requests to one host multiplex onto a single connection, so retiring that connection fails every in-flight request at once. mix lightning.install_schemas lost about a quarter of its fetches to :closed this way. They were retried, but a transport change is not something this upgrade needs. tzdata's autoupdater works again now that it accepts hackney 4, so drop the config that disabled it. Disable it in test instead: it polls IANA a few seconds after boot, and CI starts from a fresh container every run. * Retry hackney's mislabelled stale-pool error in install_schemas hackney keeps a closing pooled connection alive briefly so requests that raced the checkout get an answer instead of crashing the caller. It means to answer {:closed, _} -- the comment in hackney_conn.erl says as much -- but the catch-all it falls through to answers :invalid_state, which was not in @retriable_reasons. A package hitting that race was skipped after one attempt. * Note the upstream fix for the httpoison dialyzer filters edgurgel/httpoison#511 already retypes the async struct ids as `id: pid` and drops the dead `stream_next/1` clause, so these three filters are temporary. It merged on 2026-07-05 and 3.0.0 shipped on 2026-06-14, so there is nothing to do but wait for the next release. Record that so the filters get removed then rather than outliving the bug. * Bump cowboy/cowlib, declare finch, pin the tzdata ref cowboy 2.18.0 and cowlib 2.19.0 clear EEF-CVE-2026-65624 and EEF-CVE-2026-59248. Both were published on 2026-07-28, about an hour after this branch's last lint run, so hex.audit was green then and would fail now. Back to exit 0 with only the two cowlib records that carry no fixed event. finch backs the app's own Lightning.Finch pool and the default Tesla adapter, but its version was resolving entirely through prom_ex and goth. Dropping or loosening either would break the supervision tree with no compile-time signal. Sentry 13 defaulting its client to Finch makes it worth stating outright. tzdata takes an explicit ref. The lock pinned the commit, but `github:` with no ref tracks the default branch, so unlocking it would pull whatever master happens to be at that moment into a release. Also drop the guess that the fix lands in 1.1.5: master still declares 1.1.4 and no release is scheduled. --------- Co-authored-by: Frank Midigo <midigofrank@gmail.com> Co-authored-by: Stuart Corbishley <corbish@gmail.com>
Let's allow both old and new hackney versions in order to make the transition easier for downstream projects.
Closes #155.
This is an alternative to #168.